package com.white.loggerserver

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.white.loggerserver.bean.ClientIpBean

/**
 * Created by ytf on 2020/07/24.
 * Description:
 */
class ClientIpAdapter : BaseQuickAdapter<ClientIpBean, BaseViewHolder>(R.layout.item_client_ip) {

    val icons = arrayOf(
        R.drawable.sp_dot_green,
        R.drawable.sp_dot_blue,
        R.drawable.sp_dot_red,
        R.drawable.sp_dot_orange,
        R.drawable.sp_dot_gray)

    override fun convert(holder: BaseViewHolder, item: ClientIpBean) {
        holder.setImageResource(R.id.icon, icons[item.index % 5])
        holder.setText(R.id.ip, item.ip)
    }
}